<script lang="ts" setup>
import { useUserInfoStore } from '../../stores/userInfo'

const user = useUserInfoStore()

function logout() {
    // 退出登录
    localStorage.clear()
    user.changeUserInfoState({
        loginState: false,
        userid: '',
        token: ''
    })
    // 如果想直接进入登录页面这里可以直接跳转

}
</script>
<template>
    <div class="box">
        <header class="header">我的</header>
        <div class="content">
            <div v-if="user.loginState">
                <!-- 登录 -->
                <van-button @click="logout" type="primary">退出登录</van-button>

            </div>
            <div v-else>
                <!-- 未登录 -->
                <van-button type="primary" @click="$router.push('/login')">请登录</van-button>


            </div>
        </div>
    </div>
</template>